﻿using System;
using System.Data;
using System.Collections.Generic;
using FiberRMS.Model.AlarmManager;
namespace FiberRMS.BLL.AlarmManager
{
    /// <summary>
    /// 业务逻辑类ALARM_MAP 的摘要说明。
    /// </summary>
    public class ALARM_MAP
    {
        private readonly FiberRMS.DAL.AlarmManager.ALARM_MAP dal = new FiberRMS.DAL.AlarmManager.ALARM_MAP();
        public ALARM_MAP()
        { }
        #region  成员方法
        public bool AddCause(FiberRMS.Model.AlarmManager.ALARM_MAP model)
        {
            return dal.AddCause(model);
        }
        /// <summary>
        /// 获得厂家
        /// </summary>
        /// <returns></returns>
        public DataSet getVotor()
        {
            return dal.getVotor();
        }
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(string ALARMMAPID)
        {
            return dal.Exists(ALARMMAPID);
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(FiberRMS.Model.AlarmManager.ALARM_MAP model)
        {
            return dal.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(FiberRMS.Model.AlarmManager.ALARM_MAP model)
        {
            return dal.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public void Delete(string ALARMMAPID)
        {

            dal.Delete(ALARMMAPID);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public FiberRMS.Model.AlarmManager.ALARM_MAP GetModel(string ALARMMAPID)
        {

            return dal.GetModel(ALARMMAPID);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<FiberRMS.Model.AlarmManager.ALARM_MAP> GetModelList(string strWhere)
        {
            DataSet ds = dal.GetList(strWhere);
            List<FiberRMS.Model.AlarmManager.ALARM_MAP> modelList = new List<FiberRMS.Model.AlarmManager.ALARM_MAP>();
            int rowsCount = ds.Tables[0].Rows.Count;
            if (rowsCount > 0)
            {
                FiberRMS.Model.AlarmManager.ALARM_MAP model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new FiberRMS.Model.AlarmManager.ALARM_MAP();
                    model.ALARMMAPID = ds.Tables[0].Rows[n]["ALARMMAPID"].ToString();
                    model.RESOURCEID = ds.Tables[0].Rows[n]["RESOURCEID"].ToString();
                    model.RESOURCENAME = ds.Tables[0].Rows[n]["RESOURCENAME"].ToString();
                    model.PRIMALCAUSE = ds.Tables[0].Rows[n]["PRIMALCAUSE"].ToString();
                    model.ALARMCAUSE = ds.Tables[0].Rows[n]["ALARMCAUSE"].ToString();
                    model.ALARMLEVEL = ds.Tables[0].Rows[n]["ALARMLEVEL"].ToString();
                    model.ALARMTYPE = ds.Tables[0].Rows[n]["ALARMTYPE"].ToString();
                    model.VENDOR = ds.Tables[0].Rows[n]["VENDOR"].ToString();
                    modelList.Add(model);
                }
            }
            return modelList;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllList()
        {
            return GetList("");
        }
        /// <summary>
        /// 根据条件获得告警 对应CODE字典表
        /// </summary>
        /// <param name="where"></param>
        /// <returns></returns>
        public DataSet getALLAlarmFromCommWhere(string where)
        {
            return dal.getALLAlarmFromCommWhere(where);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        //{
        //return dal.GetList(PageSize,PageIndex,strWhere);
        //}

        #endregion  成员方法
    }
}

